-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow list_transpose() to work on data frames #1141
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks great!
Do you want to update the documentation of the x
argument in the roxygen2 header above? Could you please also add a bullet to NEWS.md
?
tests/testthat/test-list-transpose.R
Outdated
@@ -140,3 +140,8 @@ test_that("fail mixing named and unnamed vectors", { | |||
test_list_transpose() | |||
}) | |||
}) | |||
|
|||
test_that("works on data frames", { | |||
expect_no_error(list_transpose(mtcars)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be a test with a simple data frame or tibble as in the test above?
x <- tibble(list(a = 1, b = 2), list(a = 3, b = 4))
...
R/list-transpose.R
Outdated
@@ -69,7 +69,13 @@ list_transpose <- function(x, | |||
simplify = NA, | |||
ptype = NULL, | |||
default = NULL) { | |||
vec_check_list(x) | |||
if(!is.list(x)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like purrr already had a check_list()
so I used it here.
Thanks for working on this! I hope you had fun at TDD 😁 |
Fixed issue #1109